package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.common.core.page.PageDomain;
import com.blrs.common.core.page.TableSupport;
import com.blrs.common.utils.page.PaginationUtil;
import com.blrs.service.qualification.IQualificationResumeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.QualificationResume;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 资质产品履历Controller
 * 
 * @author yang
 * @date 2023-09-01
 */
@RestController
@RequestMapping("/qualification/Resume")
public class QualificationResumeController extends BaseController
{
    @Autowired
    private IQualificationResumeService qualificationResumeService;

    /**
     * 查询资质产品履历列表
     */
    //@PreAuthorize("@ss.hasPermi('qualification:Resume:list')")
    @GetMapping("/list")
    public TableDataInfo list(QualificationResume qualificationResume)
    {
        startPage();
        List<QualificationResume> list = qualificationResumeService.selectQualificationResumeList(qualificationResume);
        return getDataTable(list);
    }

    /**
     * 导出资质产品履历列表
     */
    //@PreAuthorize("@ss.hasPermi('qualification:Resume:export')")
    @Log(title = "资质产品履历", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QualificationResume qualificationResume)
    {
        List<QualificationResume> list = qualificationResumeService.selectQualificationResumeList(qualificationResume);
        ExcelUtil<QualificationResume> util = new ExcelUtil<QualificationResume>(QualificationResume.class);
        util.exportExcel(response, list, "资质产品履历数据");
    }

    /**
     * 获取资质产品履历详细信息
     */
    //@PreAuthorize("@ss.hasPermi('qualification:Resume:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(qualificationResumeService.selectQualificationResumeById(id));
    }

    /**
     * 新增资质产品履历
     */
    //@PreAuthorize("@ss.hasPermi('qualification:Resume:add')")
    @Log(title = "资质产品履历", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QualificationResume qualificationResume)
    {
        return toAjax(qualificationResumeService.insertQualificationResume(qualificationResume));
    }

    /**
     * 修改资质产品履历
     */
    //@PreAuthorize("@ss.hasPermi('qualification:Resume:edit')")
    @Log(title = "资质产品履历", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QualificationResume qualificationResume)
    {
        return toAjax(qualificationResumeService.updateQualificationResume(qualificationResume));
    }


}
